var events = require("events");
var eventsEmitter = new events.EventEmitter();

//Create an event handler:
var myEventHandler = function () {
  console.log("I hear a scream!");
};
//Assign the event handler to an event:
eventsEmitter.on("scream", myEventHandler);
//Fire the 'scream' event:
eventsEmitter.emit("scream");
